package cn.getech.data.development.constant;

import lombok.Getter;

@Getter
public enum RangerPolicyItemAccessType {

    SELECT(0 , "select" ),
    UPDATE(1 , "update" ),
    CREATE(2 , "Create" ),
    DROP(3 , "Drop" ),
    ALTER(4 , "Alter" ),
    INDEX(5 , "Index" ),
    LOCK(6 , "Lock" ),
    ALL(7 , "ALL" ),
    READ(8 , "Read" ),
    WRITE(9 , "Write" ),
    REPLADMIN(10 , "ReplAdmin" ),
    SERVICE_ADMIN(11 , "Service Admin" ),
    TEMPORARY_UDF_ADMIN(12 , "Temporary UDF Admin" ),
    REFRESH(13 , "Refresh" ),
    SELECT_DESELECT_ALL(14 , "Select/Deselect All" ),
    ;
    private  int id;
    private  String  name;
    RangerPolicyItemAccessType(int id , String  name){
        this.id = id;
        this.name = name;
    }

    public static RangerPolicyItemAccessType ObjOf(Integer status) {
        if (status == null) {
            return null;
        } else {
            for (RangerPolicyItemAccessType s : RangerPolicyItemAccessType.values()) {
                if (s.getId() == status) {
                    return s;
                }
            }
            return null;
        }
    }
}
